package org.friping.mytool.views.custom.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import org.androidannotations.annotations.EBean;
import org.friping.mytool.R;

import java.util.Map;

@EBean
public class LabelValueAdapter extends AppAdapter {

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        if(convertView == null){
            convertView = inflater.inflate(R.layout.it_edit_item, null);
        }

        Map itemData = (Map) this.getItem(position);
        TextView titleView = (TextView) convertView.findViewById(R.id.title);
        TextView requiredView = (TextView) convertView.findViewById(R.id.required);
        TextView valueView = (TextView) convertView.findViewById(R.id.value);
        titleView.setText((String) itemData.get("label"));
        valueView.setText((String) itemData.get("displayValue"));

        return convertView;
    }
}
